
Ext.define('Role', {
    extend: 'Ext.data.Model',
    fields: [
        "Id"
		, "Name"   //名称
		, "Index"   //显示顺序
		, "Flag"   //状态

    ],
    idProperty: "Id"
})

Ext.define("DepartMentBox", {
    extend: "BLBTSystem.CmbData",
    alias: "widget.departmentbox",
    dataUrl:"api/department?format=json",
    model: "Department",
    name: "department",
    valueField: "Id",
    displayField: "Name"
})

Ext.define("SHApp.Sys.User.Form", {
    extend: "BLBTSystem.Form",
    submitUrl: "api/user?format=json",
    winWidth: 300,
    winHeight: 300,
    departCombox: null,
    createItems: function () {
        var me = this;
        me.items = [{
            width: 300,
            border: false,
            bodyStyle: "background:#DFE9F6",
            items: [{
                xtype: "textfield",
                fieldLabel: "ID",
                name: "Id",
                hidden: true
            }, {
                fieldLabel: "名称<span style='color:red'>*</span>",
                allowBlank: false,
                blankText: "名称不能为空",
                xtype: "textfield",
                name: "Name",
                id: "nameID",
                maxLength: 10,
                minLength: 2
            }, {
                fieldLabel: "显示名称",
                xtype: "textfield",
                name: "DisplayName",
                maxLength: 10
            }, {
                fieldLabel: "密码<span style='color:red'>*</span>",
                allowBlank: false,
                blankText: "密码不能为空",
                xtype: "textfield",
                name: "Slat",
                maxLength: 50,
                inputType: "password"
            },  {
                xtype: "datefield",
                fieldLabel: "创建时间<span style='color:red'>*</span>",
                allowBlank: false,
                id: "cDate",
                blankText: "创建时间不能为空",
                value: new Date(),
                name: "CreateDate",
                format: 'Y-m-d'
            },  {
                fieldLabel: "邮箱<span style='color:red'>*</span>",
                allowBlank: false,
                blankText: "邮箱不能为空",
                xtype: "textfield",
                name: "Email",
                maxLength: 50
            }, {
                xtype: "datefield",
                fieldLabel: "修改时间",
                id: "mDate",
                value: new Date(),
                hidden: true,
                name: "ModifiedDate",
                format: 'Y-m-d'
            }, me.departCombox, {
                xtype: "radiogroup",
                fieldLabel: "状态",
                columns: 2,
                hidden: true,
                items: [
                        { name: "Flag", boxLabel: "解锁", inputValue: 0 },
                        { name: "Flag", boxLabel: "锁定", inputValue: 1 }
                    ]
            }]
        }
    ]
    },
    createCmb: function () {
        var cmb = Ext.create("DepartMentBox", {
            name: "DepartID",
            fieldLabel: "<span style='color:red'>*</span>部门名称",
            allowBlank: false,
            blankText: "部门不能为空"
        })
        this.departCombox = cmb;
    },
    initComponent: function () {
        Ext.apply(this);
        this.createCmb();
        this.createItems();
        this.callParent(arguments);
    }
})